package com.chuantou.yuba.api.to;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

public class BDGeoTO implements Parcelable {
	// 经纬度
	@SerializedName("location")
	private BDLocationTO location;
	// 详细地址
	@SerializedName("formatted_address")
	private String formatedAddress;
	// 地址信息
	@SerializedName("addressComponent")
	private BDAddressTO address;
	// 兴趣地点
	@SerializedName("pois")
	private List<BDPoiTO> pois;

	public BDGeoTO() {
	}

	public BDGeoTO(Parcel source) {
		this.location = source.readParcelable(BDLocationTO.class.getClassLoader());
		this.formatedAddress = source.readString();
		this.address = source.readParcelable(BDAddressTO.class.getClassLoader());
		this.pois = new ArrayList<BDPoiTO>();
		source.readTypedList(this.pois, BDPoiTO.CREATOR);
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeParcelable(location, flags);
		dest.writeString(formatedAddress);
		dest.writeParcelable(address, flags);
		dest.writeTypedList(pois);
	}

	public static final Creator<BDGeoTO> CREATOR = new Creator<BDGeoTO>() {

		@Override
		public BDGeoTO[] newArray(int size) {
			return new BDGeoTO[size];
		}

		@Override
		public BDGeoTO createFromParcel(Parcel source) {
			return new BDGeoTO(source);
		}
	};

	public BDLocationTO getLocation() {
		return location;
	}

	public void setLocation(BDLocationTO location) {
		this.location = location;
	}

	public String getFormatedAddress() {
		return formatedAddress;
	}

	public void setFormatedAddress(String formatedAddress) {
		this.formatedAddress = formatedAddress;
	}

	public BDAddressTO getAddress() {
		return address;
	}

	public void setAddress(BDAddressTO address) {
		this.address = address;
	}

	public List<BDPoiTO> getPois() {
		return pois == null ? new ArrayList<BDPoiTO>() : pois;
	}

	public void setPois(List<BDPoiTO> pois) {
		this.pois = pois;
	}

}
